package com.lcxedu.notebook.mapper;

import com.lcxedu.notebook.entity.Event;
import com.lcxedu.notebook.entity.EventWithCategory;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;


public interface EventMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Event record);

    int insertSelective(Event record);

    Event selectByPrimaryKey(Integer id);

    List<Event> selectAll();

    List<EventWithCategory> getAllEventsWithCategoriesByUserId(Integer userId);

    @Delete("DELETE FROM event WHERE id = #{id}")
    void deleteById(Integer id);

    List<EventWithCategory> getAllEventsWithCategoriesByPage
            (@Param("userId") Integer userId, @Param("keyword") String keyword);

    int updateByPrimaryKeySelective(Event record);

    int updateByPrimaryKey(Event record);

    // 新增多条件查询方法
    List<EventWithCategory> getAllEventsWithCategoriesByCondition(
            @Param("userId") Integer userId,
            @Param("title") String title,
            @Param("categoryId") Integer categoryId,
            @Param("level") String level,
            @Param("status") String status
    );
}